/*
	@Author£ºTangYi

	Description:Ò»¸öÍ¨ÓÃµÄWindows CÓïÑÔµÄÇáÐÍÍøÂç¿ò¼Ü

	Ô­À´´òËãÐ´Ò»¸öÁ½¸öÈË»ðÆ´¶íÂÞË¹»ýÄ¾µÄ·þÎñ¶Ë£¬ÎÞÄÎ£¬´óËÄÀ´ÁË£¬Éú»îËùÆÈ£¬
	¼Æ»®ÕÒ¹¤×÷¡£´úÂëËäÈ»ÊÇÔÚWindowsÉÏ»ù´¡ÉÏ¿ª·¢£¬µ«Ã»ÓÐÌ«ÒÀÀµ²Ù×÷ÏµÍ³£¬ºÜÈÝÒ×
	ÒÆÖ²µ½LinuxÉÏ£¬WindowsÉÏµÄSelectÄ£ÐÍÓÐËùÏÞÖÆ£¬ÈçÓÃLinuxµÄEpollÄ£ÐÍ£¬Ð§ÂÊ»áºÃ
	ºÜ¶à¡£

	Ô¸ÉÏµÛ±£ÓÓÄãºÍÎÒ£¡

	C³ÌÐò×îÌÖÑáµÄ¾ÍÊÇÒ»²»Ð¡ÐÄÍüfreeÁË£¬¹Ø¼üÊÇ£¬´úÂë¶àÁË£¬Äã¾Í²»ÖªµÀÄÄÁËÍûÁË
*/

#include "debug_log.h"
#include "lock.h"
#include "connection.h"
#include "select_model.h"
#include "config.h"
#include "vs_world.h"
#include <windows.h>

vs_world_t* g_vs_world;

int main()
{
	init_global_cycle();
	init_select_model();

	g_vs_world = init_vs_world();

	//¿ªÊ¼Âß¼­Ïß³Ì
	g_vs_world->worker_thead_handle = CreateThread(NULL,0,vs_world_worker_thread,
		(void*)g_vs_world,NULL,NULL);

	struct timeval tv;
	tv.tv_sec = 0;
	tv.tv_usec = 30;

	dbg_print("¿ªÊ¼¼àÌý...");
	
	select_config_t* select_config = init_select_config();

	dbg_log("½øÈëÖ÷Ñ­»·");
	while(!g_vs_world->world_stop)
	{
		flush_packets();
		block_select(select_config,&tv);
	}
	
	system("pause");
}